
/*class MyArray {
    //Object类型数组
    Object[] arr = new Object[3];
    public void show() {
        //分别初始化三种不同类型的数据
        arr[0] = 1;
        arr[1] = 1.2;
        arr[2] = "abc";
        //遍历arr数组
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}*/

/*class MyArray<T> {
    //创建一个泛型数组
    public Object[] arr = new Object[3];
    //get方法
    public T getPos (int pos) {
        return (T)arr[pos];
    }
    //set方法
    public void setArr (int pos,T value) {
        arr[pos] = value;
    }
}*/

class Array {
    public <T extends Comparable<T>> T maxNum(T[] num){
        T max = num[0];
        for (int i = 0; i < num.length; i++) {
            if (max.compareTo(num[i]) < 0) {
                max = num[i];
            }
        }
        return max;
    }
}
public class Test {
    public static void main(String[] args) {
        Array array = new Array();
        Integer[] arr = {1,23,4,5,6,7};
        int num=array.maxNum(arr);
        System.out.println(num);
    }
}
/*class MaxArray<T extends Comparable<T> > {

}*/

//class Array<T extends Number> {
//    //内容
//}

/*class MaxArray<T extends Comparable<T>> {
    public void findMax(T[] arr) {
        T max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max.compareTo(arr[i]) < 0) {
                max = arr[i];
            }
        }
        System.out.println(max);
    }
}*/

/*class Num<T extends Number> {
    public Object[] arr = new Object[3];
    public void show() {
        arr[0] = 1;
        arr[1] = a;
        arr[2] = 1.2;
    }*/
/*}*/

